import 'package:flutter/material.dart';

class NavBar extends StatefulWidget with PreferredSizeWidget{
  final Map config;
  NavBar(this.config, {Key key}) : super(key: key);

  @override
  _NavBarState createState() => _NavBarState(config: this.config);

  @override
  Size get preferredSize => Size.fromHeight(56);
}

class _NavBarState extends State<NavBar>{
  final Map config;
  _NavBarState({this.config});

  // final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        
        elevation: this.config['elevation'] == null ? 4 : this.config['elevation'],
        centerTitle: true,
        title: Text('${this.config['title']}'),
        backgroundColor: this.config['backgroundColor'] == null ? Colors.blue : this.config['backgroundColor'],
      ),
    );
  }
}